
{% extends 'base.html' %}
{% load static %}


{% block content %}
<div class="content-section">
    <form id="search" action="" method="GET">
        <!-- {% csrf_token %} -->
        <!-- <label for="text">输入快速定位码以找到之前的提问</label> -->
        <div class="input-group">
            <input type="text" name="question" class="form-control" placeholder="北京冬季奥运会的相关问题" aria-describedby="button-addon4">
            <input id='askorsearch' type="hidden" name="askorsearch" value="ask">

            <div class="input-group-append" id="button-addon4">
              <button type="button" class="btn btn-outline-secondary" onclick="submit_form(this.form, 1)">提问</button>
              <button type="button" class="btn btn-outline-secondary" onclick="submit_form(this.form, 2)">搜索</button>
            </div>
          </div>
          
        <!-- <div class="form-group">
            <input type="number" name="locate_id" class="textinput textInput form-control" required id='id_locate'>
        </div>
        <div class="form-group">
            <button class="btn btn-outline-info" type="submit">提交</button>
        </div> -->
    </form>
</div>



{% for post in posts %}
<article class="media content-section">
    <!-- <img class="rounded-circle article-img" src="{{ post.author.profile.image.url }}"> -->
    <div class="media-body">
        <div class="article-metadata">
            <small class="text-muted">{{ post.date_posted }} {{ post.author }}</small>
        </div>
        <div class="article-metadata">
            <h5>{{ post.question }}</h5>
            <small class='text-muted'>
                <a class="mr-2" href="{% url 'detail' post.id %}">查看详情</a>
                {% if post.mrc_answered %}(MRC 问答模型 已回答){% endif %}
            </small>
        </div>

    </div>
</article>
{% endfor %}

<div class="text-center">
    <a href="{% url 'home'%}">所有问题</a>

    {% if page_obj.has_previous %}
    <a id='left' href="javascript:prev({{ page_obj.previous_page_number }})">上一页 </a>
    {% endif %}

    <a>第{{ page_obj.number }}页 共{{ page_obj.paginator.num_pages }}页 </a>

    {% if page_obj.has_next %}
    <a id='right' href="javascript:next({{page_obj.next_page_number}})"> 下一页</a>
    {% endif %}
</div>

{% endblock %}

{% block rightbar %}


<!-- </div> -->

<div class="content-section">
<h5>问答社区说明</h5>
<p> </p>
<p>· <strong>MRC 问答模型</strong> 将快速地给出问题的答案</p>
<p>· <strong>社区志愿者</strong> 将不定期进行实时解答</p>

</div>
<script id="cid0020000288805655273" data-cfasync="false" async src="//st.chatango.com/js/gz/emb.js"
    style="width: 100%;height: 100%;">{ "handle": "winterolympic", "arch": "js", "styles": { "a": "ffffff", "b": 100, "c": "000000", "d": "000000", "f": 0, "i": 0, "k": "404040", "l": "e0e0e0", "m": "e0e0e0", "p": "10", "q": "e0e0e0", "r": 100, "t": 0, "usricon": 0, "surl": 0, "cnrs": "0.33", "fwtickm": 1 } }
</script>
{% endblock %}

{% block js %}
<script src="{% static 'js/button.js'%}"></script>
{% endblock %}